package com.xzy.aaa.postprocessor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

import java.util.Arrays;

/**
 * 创建一个实现BeanFactoryPostProcessor接口的类，用于在Bean工厂加载过程中对Bean进行处理
 *
 * @author xzy.xiao
 * @date 2023/7/4  19:38
 */
@Slf4j
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        log.info("Post process bean factory: BeanDefinition - {}", Arrays.asList(beanFactory.getBeanDefinitionNames()));
        // 在这里可以修改Bean的定义或添加新的Bean定义
    }
}
